Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Jul 16, 2025

Adds a TypeScript-based ROS2 topics demo using rclnodejs, including publisher and subscriber examples, build configuration, and documentation.

  • Introduce tsconfig.json for TypeScript compilation.
  • Add publisher.ts and subscriber.ts demo implementations.
  • Provide package.json scripts and detailed README.md guide.

Fix: #1192

@minggangw minggangw requested a review from Copilot July 16, 2025 05:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a TypeScript-based ROS2 topics demo using rclnodejs, including publisher and subscriber examples, build configuration, and documentation.

  • Introduce tsconfig.json for TypeScript compilation.
  • Add publisher.ts and subscriber.ts demo implementations.
  • Provide package.json scripts and detailed README.md guide.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ts_demo/topics/tsconfig.json TypeScript compiler configuration for the demo
ts_demo/topics/src/subscriber.ts Subscriber example implementation
ts_demo/topics/src/publisher.ts Publisher example implementation
ts_demo/topics/package.json Project metadata, dependencies, and npm scripts
ts_demo/topics/README.md Demo documentation, usage instructions, and examples
Comments suppressed due to low confidence (1)

ts_demo/topics/README.md:137

  • The README shows a 1000ms timer interval, but the code logs and uses 1000000000n. Please align the documentation with the implementation by updating either the code or the README.
✓ Created timer with 1000ms interval

import * as rclnodejs from 'rclnodejs';

const TOPIC_NAME = 'ts_demo';
const PUBLISH_INTERVAL = 1000000000n; // milliseconds
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PUBLISH_INTERVAL is declared as a BigInt (1000000000n) and labeled as milliseconds, which will result in a very long delay (about 11.5 days) and doesn’t match the README’s 1000ms example. Consider using a numeric literal (e.g., 1000) instead to match the intended interval.

Suggested change
const PUBLISH_INTERVAL = 1000000000n; // milliseconds
const PUBLISH_INTERVAL = 1000; // milliseconds

Copilot uses AI. Check for mistakes.
"name": "rclnodejs-ts-topics-demo",
"version": "1.0.0",
"description": "TypeScript demo for rclnodejs topics (publisher and subscriber)",
"main": "index.js",
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The main field points to index.js, which doesn’t exist in this project. Update it to an existing entry (e.g., dist/publisher.js) or remove it if unused.

Suggested change
"main": "index.js",
"main": "dist/publisher.js",

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

coveralls commented Jul 16, 2025

Coverage Status

coverage: 84.526%. remained the same
when pulling a0d56ee on minggangw:fix-1192
into ccb9c21 on RobotWebTools:develop.

@minggangw minggangw merged commit b62740d into RobotWebTools:develop Jul 16, 2025
27 of 28 checks passed
minggangw added a commit that referenced this pull request Jul 16, 2025
Adds a TypeScript-based ROS2 topics demo using rclnodejs, including publisher and subscriber examples, build configuration, and documentation.

- Introduce `tsconfig.json` for TypeScript compilation.
- Add `publisher.ts` and `subscriber.ts` demo implementations.
- Provide `package.json` scripts and detailed `README.md` guide.

Fix: #1192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a demo for publisher/subscriber using typescript

2 participants